import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

const routes = [
  { 
    path: '/', 
    redirect: '/homePage' 
  },
  { 
    path: '/homePage', 
    name: 'homePage',
    meta: { title: '主页' },
    component: () => import('@/views/HomePage.vue')
  },
  { 
    path: '/userinfo', 
    name: 'userinfo',
    meta: { title: '用户信息' },
    component: () => import('@/views/UserInfo.vue')
  },
  { 
     path: '/sqlEditor',
     name: 'sqlEditor',
     meta: { title: 'sql编辑' },
     component: () => import('@/views/SqlEditor.vue')
  },
  {
    path: '/userManage',
    name: 'UserManage',
    meta: { title: '用户管理' },
    component: () => import('@/views/UserManage.vue')
  },
  {
    path: '/dataSource',
    name: 'DataSouce',
    meta: { title: '数据源管理' },
    component: () => import('@/views/DataSource.vue')
  }
];

const router = new VueRouter({
  mode: 'history', // 采用 history 模式
  routes
});

export default router;
